#include "gigeccdintf.h"

#include <QLibrary>

GigeCcdIntf::GigeCcdIntf(const QString &gigeLib)
{
    QLibrary lib(gigeLib);
    if (!lib.load()) {
        err = lib.errorString();
    } else {
        MVC_CloseDevice = (T_MVC_CloseDevice)lib.resolve("MVC_CloseDevice");
        MVC_ReScanDevice = (T_MVC_ReScanDevice)lib.resolve("MVC_ReScanDevice");
        MVC_GetDeviceNumber = (T_MVC_GetDeviceNumber)lib.resolve("MVC_GetDeviceNumber");
        MVC_GetDeviceInfoEx = (T_MVC_GetDeviceInfoEx)lib.resolve("MVC_GetDeviceInfoEx");
        MVC_AutoIPConfig = (T_MVC_AutoIPConfig)lib.resolve("MVC_AutoIPConfig");
        MVC_OpenDevice = (T_MVC_OpenDevice)lib.resolve("MVC_OpenDevice");
        MVC_SetParameter = (T_MVC_SetParameter)lib.resolve("MVC_SetParameter");
        MVC_EnableCapture = (T_MVC_EnableCapture)lib.resolve("MVC_EnableCapture");
        MVC_SetStreamHOOK = (T_MVC_SetStreamHOOK)lib.resolve("MVC_SetStreamHOOK");
        MVC_SetDevLostHOOK = (T_MVC_SetDevLostHOOK)lib.resolve("MVC_SetDevLostHOOK");
        MVC_DisableCapture = (T_MVC_DisableCapture)lib.resolve("MVC_DisableCapture");

        if (!(MVC_CloseDevice && MVC_ReScanDevice && MVC_GetDeviceNumber &&
                MVC_GetDeviceInfoEx && MVC_AutoIPConfig && MVC_OpenDevice &&
                MVC_SetParameter && MVC_EnableCapture && MVC_SetStreamHOOK &&
                MVC_SetDevLostHOOK && MVC_DisableCapture))
            err = QObject::tr("Some acquisit api not found.");
    }
}
